<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        /**
         *捕获器不变式防止捕获器出现反常行为
         *比如目标对象有一个不可读写数据属性，那么捕获器在返回与其不同的值时会报错 
         **/
        const target ={}
        Object.defineProperty(target, 'foo', {
            configurable: false,
            writable: false,
            value: 'bar'
        })

        const proxy = new Proxy(target, {
            get() {
                return 'xiaomi'
            }
        })
        console.log(proxy.foo) // 报错
    </script>
</body>
</html>